package com.ts.api.module.match.market.internal.wrapper;

import com.ts.api.module.api.entity.ApiUserRequest;
import com.ts.api.module.channel.entity.po.ChannelUserFormFieldPO;
import com.ts.api.module.channel.entity.po.ChannelUserRegisterPO;
import com.ts.api.module.match.market.internal.wrapper.model.MarketDataExchange;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 *  撞库-用户表单模式包装器
 *
 *  @author Pan
 */
@Component
public class MarketDataExchangeUserFormWrapper implements MarketDataExchangeWrapper {

    @Override
    public ApiUserRequest wrap(MarketDataExchange marketDataExchange) {
        List<ChannelUserFormFieldPO> listUserFormFieldPO = marketDataExchange.getListUserFormFieldPO();
        ChannelUserRegisterPO channelUserRegisterPO = marketDataExchange.getChannelUserRegisterPO();
        ApiUserRequest apiUserRequest = ApiUserRequest.convert(channelUserRegisterPO, listUserFormFieldPO);

        //  屏蔽字段
        apiUserRequest.setPhone(null);
        apiUserRequest.setUserId(null);
        apiUserRequest.setUserName(null);
        apiUserRequest.setIdcard(null);
        return apiUserRequest;
    }
}
